const state = {
    money: 2
}

const mutations = {
    add(state) {
        state.money++
    },
    reduce(state) {
        state.money--
    }
}

const actions = {
    add: ({ commit }) => {
        commit('add')
    },
    reduce: ({ commit }) => {
        commit('reduce')
    }
}

export default {
    //命名空间, 防止命名冲突, 使用时需要加上模块名
    namespaced: true,
    state,
    mutations,
    actions
}